<template lang="pug">
  kalix-dialog.user-add(title='添加' bizKey="histogramtitle" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="UUID" prop="uuid"  v-bind:rules="rules.uuid" v-bind:label-width="labelWidth")
        el-input(v-model="formModel.uuid" )
      el-form-item(label="应用名称" prop="appname" v-bind:label-width="labelWidth" v-bind:rules="rules.appname")
        kalix-select(v-model="formModel.appname" v-bind:requestUrl="summaryURL" appName="summaryColumn"  placeholder="请选择应用"
        v-bind:paramObj="summaryParam" v-bind:defaultSelect="true" v-on:selectChange="setGroup" label="name")
      el-form-item(label="系统" prop="system" v-bind:label-width="labelWidth" v-bind:rules="rules.system")
        el-select(v-model="formModel.system" placeholder="请选择系统" @change="getDoctorName")
          el-option(v-for="item in filePathArr" :key="item.value" :label="item.label" :value="item.value")
</template>

<script type="text/ecmascript-6">
  import {KshHistogramtitleURL, KshSummaryURL} from '../config.toml'
  import FormModel from './model'

  export default {
    name: 'HistogramtitleAdd',
    data() {
      return {
        summaryURL: KshSummaryURL,
        formModel: Object.assign({}, FormModel),
        labelWidth: '120px',
        name: '',
        summaryParam: undefined,
        filePathArr: [
          {
            label: 'Windows',
            value: 'Windows'
          },
          {
            label: 'Linux',
            value: 'Linux'
          }
        ],
        rules: {
          // uuid: [{required: true, message: '请输入UUID', trigger: 'change'}],
          appname: [{required: true, message: '请选择属于应用', trigger: 'blur'}]
          // system: [{required: true, message: '请选择系统', trigger: 'change'}]
        },
        targetURL: KshHistogramtitleURL
      }
    },
    methods: {
      setGroup(item) {
        this.formModel.appname = item.name
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
